<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <script src="./js/JSON.js"></script>
		<title>04.JSON</title>
		<script>
			/**
			 * stringify：把对象转换成字符串
			 * parse：把字符串转换成对象
			 */
			var arr1 = [100, 200, 300];
			var arrStr = JSON.stringify(arr1);
			// string
			// alert(typeof arrStr);
			
			var json1 = { "name" : "xiaoxiaoyou" };
			var jsonStr = JSON.stringify(json1);
			// string
			// alert(typeof jsonStr);
			
			var str1 = '["a", "b", "c"]';
			var strArr = JSON.parse(str1);
			// object
			// alert(typeof strArr);
			
			var str2 = '{ "left" : 200 }';
			var strJson = JSON.parse(str2);
			// object
			alert(typeof strJson);
		</script>
	</head>
	<body>
		
	</body>
</html>
